<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%>
<%
    String rootPath = request.getContextPath();
%>
<!DOCTYPE>
<html>
<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>我的物品</title>
<meta name="viewport" content="initial-scale=1, maximum-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
<meta name="apple-mobile-web-app-status-bar-style" content="black" />
<link rel="stylesheet"
	href="//g.alicdn.com/msui/sm/0.6.2/css/sm.min.css" />
<link rel="stylesheet"
	href="//g.alicdn.com/msui/sm/0.6.2/css/sm-extend.min.css" />
<link rel="stylesheet" href="../static/weixin.css" />
</head>
<body>
	<form id="buyfrm" method="post">
		<div class="content">
		<input type="hidden" id="openId" name="openId" value="${openId}" />
		<input type="hidden" id="unitprice" name="memberBuy.unitprice" value="${sysMemeberType.unitPrice}">
		  <div class="list-block">
		    <ul>
			 <li class="item-content">
			      <div class="item-inner">
		          <div class="item-title">单价</div>
		          <div class="item-title">￥${sysMemeberType.unitPrice}【${sysMemeberType.typeName}】</div>
		        </div>
	   		  </li>
			 <li class="item-content item-link">
			      <div class="item-inner">
		          <div class="item-title">型号</div>
		          <div class="item-title">
		           <input type="text" id='categoryName' name="memberBuy.categoryName" placeholder="请选择型号" value="48-12方孔"></div>
		        </div>
	   		  </li>
			  <li class="item-content">
			      <div class="item-inner">
		          <div class="item-title">数量</div>
		          <div class="item-title"><input type="text" id='num' name="memberBuy.num" value="1"/></div>
		        </div>
	   		  </li>
	   		  <li class="item-content">
			      <div class="item-inner">
		          <div class="item-title">金额</div>
		          <div class="item-title"><input type="text" id="money" name="memberBuy.money" value="${sysMemeberType.unitPrice}"></div>
		        </div>
	   		  </li>
	   		  <li class="item-content">
			    <div class="item-inner">
		          <div class="item-title">收货地址</div>
		        </div>
	   		  </li>
	   		  <li class="item-content item-link">
		        <div class="item-media"><i class="icon icon-f7"></i></div>
		         <div class="item-inner">
		         <!--  <div class="item-title">商品名称</div>
		          <div class="item-after">杜蕾斯</div> -->
		          	<textarea id="address" name="memberBuy.addressinfo"></textarea>
		          	
		        </div>
		      </li>
		    
	   		  <li class="align-top">
		        <div class="item-content">
		          <!-- <div class="item-media"><i class="icon icon-form-comment"></i></div> -->
		          <div class="item-inner">
		            <div class="item-title label">备注</div>
		            <div class="item-input">
		            	<input type="text" id="remark" name="memberBuy.remark">
		            </div>
		          </div>
		        </div>
		      </li>
		     </ul>
		    </div>
		    
		 <div class="content-block">
		    <div class="row">
		      <div class="col-50"><a href="#" class="button button-big button-fill button-danger">取消</a></div>
		      <div class="col-50" onclick="doBuy();"><a href="#" class="button button-big button-fill button-success">提交</a></div>
		    </div>
		  </div>
		 </div>
	</form>
</body>
   <script type='text/javascript' src='//g.alicdn.com/sj/lib/zepto/zepto.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm.min.js' charset='utf-8'></script>
    <script type='text/javascript' src='//g.alicdn.com/msui/sm/0.6.2/js/sm-extend.min.js' charset='utf-8'></script>
    <script type="text/javascript" src="//g.alicdn.com/msui/sm/0.6.2/js/sm-city-picker.min.js" charset="utf-8"></script>
    


<script type="text/javascript">

$(document).ready(function() {
	/* $("#textjquery").click(function(event) {
		alert('您的鼠标移到了 id="p1" 的元素上!');
	}); */
	<%-- alert("exect");
	var addressary = new Array();
	var ajaxurl="<%=rootPath%>/json/queryOwerAddress";
	alert(ajaxurl);
    $.ajax({
             type: "POST",
             url: ajaxurl,//点击登录按钮走的action
             data: {username:$("#username").val(), password:$("#password").val()},
             data:{openId:1},
             async: false,
             dataType: "json",
             success: function(data){
            	 if(data.flag == true ){
            		 if( data.addressLen>0){
            			 addressary=data.addresslst;
            			 alert("addressary success:::"+addressary.length);
            		 }
            	 }
             },
             error: function(data){
            	 alert(data.msg);
             }
         });
   
    alert("addressary end:::"+addressary.length);  --%>
    
   /*  $("#address").picker({
    	  toolbarTemplate: '<header class="bar bar-nav">\
    	  <button class="button button-link pull-right close-picker">确定</button>\
    	  <h1 class="title">请选择收货地址</h1>\
    	  </header>',
    	  cols: [
    	    {
    	      textAlign: 'center',
    	       values: ['iPhone 4', 'iPhone 4S', 'iPhone 5', 'iPhone 5S', 'iPhone 6', 'iPhone 6 Plus', 'iPad 2', 'iPad Retina', 'iPad Air', 'iPad mini', 'iPad mini 2', 'iPad mini 3'] 
    	    	values:[
    	    	        for(var i=0;i<addressary.length;i++){
    	    	        	address[i].username+':'+address[i].phone+":"+address[i].area
    	    	        	}
    	    	        ]
    	    }
    	  ]
    	}); */
  	
});
$("#num").picker({
	  toolbarTemplate: '<header class="bar bar-nav">\
	  <button class="button button-link pull-right close-picker" onclick="onPickerNum();">确定</button>\
	  <h1 class="title">请选择数量</h1>\
	  </header>',
	  cols: [
	    {
	      textAlign: 'center',
	      values: ['1', '2', '3', '4', '5', '6', '7', '8', '9', '10', '15', '20']
	    }
	  ]
	});

function onPickerNum(){
	var num =$("#num").val();
	var unitprice=$("#unitprice").val();
	$("#money").val(unitprice * 10000 * num / 10000);
}

	
$("#categoryName").picker({
	toolbarTemplate: '<header class="bar bar-nav">\
	<button class="button button-link pull-right close-picker">确定</button>\
	<h1 class="title">请选择型号</h1>\
	</header>',
	cols: [
	    {
	      textAlign: 'center',
	      values: ['48-12', '48-20', '60-20']
	    },
	    {
	      textAlign: 'center',
	      values: ['方孔', '圆孔']
	    }
  	]
});
	
	
function doBuy(){
	buyfrm.action="<%=rootPath %>/weixin/buy";
	buyfrm.submit();
}
</script>
</html>